/**
 * 定义模块的加载路径
 */
require.config({
	paths: {
		"vue" : "/assets/web/lib/vue/vue2",
		"vue-router" : "/assets/web/lib/vue/vue-router",
		"vee-validate": "/assets/web/lib/vee-validate/vee-validate.min",
		"zh_CN": "/assets/web/lib/vee-validate/zh_CN",
		
		"we-quill": "/framework/components/we-quill/we-quill",
		"we-validator": "/framework/components/validator/we-validator",
		
		"nav": "/modules/web/aboutus/components/nav",
		"content": "/modules/web/aboutus/components/content",
		"footer": "/modules/web/aboutus/components/footer",
		
		"content-sider": "/modules/web/aboutus/components/sub/sider",
		"content-rel": "/modules/web/aboutus/components/sub/rel",
		"content-link": "/modules/web/aboutus/components/sub/link",
		"content-law": "/modules/web/aboutus/components/sub/law",
		"name-view": "/modules/web/aboutus/components/sub/name-view",
		
		"router": "/modules/web/aboutus/router/index",
		"store": "/modules/web/aboutus/mixins/store"
	}　　　　
});

/**
 * 入口js，挂载vue根实例
 */
require(['vue','nav','footer','content','router','we-validator','content-rel'], function (Vue,nav,footer,content,router,Validator,contentRel){
	
	var dict = {
		cn: {
	      //字段定义
	      attributes:{
	        mobile: '移动电话'
	      }
	   }
	};
	Validator.localize(dict);
	
	
	/*
	 * 自定义验证规则,使用示例：
	 * <input v-validate="'required|mobile'" name="mobile" type="text">
	 * <span>{{errors.first('mobile') }}</span>
	 */
	Validator.extend('mobile', {
		validate: function(value){
			return value.length === 11 && /^((13|14|15|17|18)[0-9]{1}\d{8})$/.test(value);
		},
	    getMessage: function(field){
	    	return "请输入正确的手机号" ;
	    }
	});
	
    //挂载
	new Vue({
		el: '#app',
		router:router,
		created:function(){
			Vue.nextTick(function(){
			}) ;
		},
		//局部注册组件
		components:{
			'component-nav':nav,
			'component-content':content,
			'component-footer':footer,
			'content-rel':contentRel
		}
	})
});